#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
const int N = 1e5 + 5;

int n, m;
int a[N];
struct Node {
  int op, l, r;
} b[N];
int pos;
int sum[N << 2], tag[N << 2];
void pushup(int p) { sum[p] = sum[p << 1] + sum[p << 1 | 1]; }
void build(int v, int p, int l, int r) {
  tag[p] = -1;
  if (l == r) {
    sum[p] = a[l] >= v ? 1 : 0;
    return;
  }
  int mid = (l + r) >> 1;
  build(v, p << 1, l, mid);
  build(v, p << 1 | 1, mid + 1, r);
  pushup(p);
}
void addtag(int d, int p, int l, int r) {
  tag[p] = d;
  sum[p] = (r + 1 - l) * d;
}
void pushdown(int p, int l, int r) {
  if (tag[p] != -1) {
    int mid = (l + r) >> 1;
    addtag(tag[p], p << 1, l, mid);
    addtag(tag[p], p << 1 | 1, mid + 1, r);
    tag[p] = -1;
  }
}
void update(int L, int R, int d, int p, int l, int r) {
  if (L > R) return;
  if (L <= l && R >= r) {
    addtag(d, p, l, r);
    return;
  }
  pushdown(p, l, r);
  int mid = (l + r) >> 1;
  if (L <= mid) update(L, R, d, p << 1, l, mid);
  if (R > mid) update(L, R, d, p << 1 | 1, mid + 1, r);
  pushup(p);
}
int query(int L, int R, int p, int l, int r) {
  if (L <= l && R >= r) return sum[p];
  pushdown(p, l, r);
  int mid = (l + r) >> 1;
  int res = 0;
  if (L <= mid) res += query(L, R, p << 1, l, mid);
  if (R > mid) res += query(L, R, p << 1 | 1, mid + 1, r);
  return res;
}
void change(int L, int R, int op) {
  int sum = query(L, R, 1, 1, n);
  if (op == 0) {  // 0 0 1 1
    int mid = R - sum;
    update(L, mid, 0, 1, 1, n);
    update(mid + 1, R, 1, 1, 1, n);
  } else {  // 1 1 0 0
    int mid = L + sum - 1;
    update(L, mid, 1, 1, 1, n);
    update(mid + 1, R, 0, 1, 1, n);
  }
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n >> m;
  rep(i, 1, n) cin >> a[i];
  rep(i, 1, m) cin >> b[i].op >> b[i].l >> b[i].r;
  cin >> pos;
  int l = 1, r = n;
  while (l <= r) {
    int mid = (l + r) >> 1;
    build(mid, 1, 1, n);

    rep(i, 1, m) change(b[i].l, b[i].r, b[i].op);
    int res = query(pos, pos, 1, 1, n);
    if (res == 1)  // val >= mid
      l = mid + 1;
    else  // val < mid
      r = mid - 1;
  }
  cout << r;
  return 0;
}